# _*_ encoding:utf-8 _*_

from django import forms
from captcha.fields import CaptchaField


class UserLoginForm(forms.Form):
    username = forms.CharField(required=True, error_messages={
        'required': u'用户名必须填写'
    })
    password = forms.CharField(required=True, min_length=6, max_length=20, error_messages={
        'required': u'密码必须填写',
        'min_length': u'密码不能短于6位数',
        'max_length': u'密码不能长于20位数',
    })


class RegisterForm(forms.Form):
    email = forms.EmailField(required=True, error_messages={
        'requried': u'邮箱不能为空',
    })
    password = forms.CharField(required=True, min_length=6, max_length=20, error_messages={
        'requried': u'密码不能为空',
        'min_length': u'密码不能短于6位数',
        'max_length': u'密码不能长于20位数',
    })
    captcha = CaptchaField(required=True, error_messages={
                           'invalid': u'验证码不正确'})
    success = False


class ForgetPwdForm(forms.Form):
    email = forms.EmailField(required=True, error_messages={
        'requried': u'邮箱不能为空',
    })
    captcha = CaptchaField(required=True, error_messages={
                           'invalid': u'验证码不正确'})


class ModifyPwdForm(forms.Form):
    email = forms.EmailField(required=False)
    code = forms.CharField(required=False)
    password1 = forms.CharField(required=True, min_length=6, max_length=20, error_messages={
        'requried': u'密码不能为空',
        'min_length': u'密码不能短于6位数',
        'max_length': u'密码不能长于20位数',
    })
    password2 = forms.CharField(required=True, min_length=6, max_length=20, error_messages={
        'requried': u'密码不能为空',
        'min_length': u'密码不能短于6位数',
        'max_length': u'密码不能长于20位数',
    })
    success = False
